using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ChatGpt_WebApp.ThirdApi
{
    public abstract class ChatApiBase : IChatApi
    {
        /// <summary>
        /// 获取性格模型
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        protected CharacterInfo GetCharacter(int id)
        {
            var list = AppSetting.Current!.ChatGpt.Character!.Characters;

            var find = list.FirstOrDefault(f => f.Id == id);
            if (find == null) return CharacterInfo.Default;

            return find;
        }

        public abstract Task<ChatResult> Ask(string question, string sessionid, int clientid, int characterId);
        public abstract Task ResetConversation(string sessionid, int clientid);
    }
}